<?php
/* @var $this SelisteController */
/* @var $model Seliste */
$cs = Yii::app()->getClientScript();
$cs->registerScript('mailbox', "
		$('#mailbox_toolbar .btn').tooltip();
",CClientScript::POS_READY );
?>

<div class="container">
		
	<div class="row">
		<div class="col-lg-12">		
			<div class="page-header">	
				<h1>Boite de réception
					<div class="btn-group" id="mailbox_toolbar">
					<?php 
					echo CHtml::link("<span class=\"fa fa-pencil\"></span>",array('seliste/newmail'),array('class'=>"btn btn-sm btn-primary","data-toggle"=>"tooltip","data-placement"=>"top","title"=>"Nouveau message","data-container"=>"body"));
					echo CHtml::link("<span class=\"fa fa-send\"></span>",array('seliste/sentmail'),array('class'=>"btn btn-sm btn-primary","data-toggle"=>"tooltip","data-placement"=>"top","title"=>"Messages envoyés","data-container"=>"body"));
					?>
					</div>
				</h1>
			</div>
		</div>
	</div>
	
	<div class="row">
		<div class="col-lg-12">
			<?php $this->widget('ext.bs3gridview.widgets.Bs3GridView', array(
				'id'=>'mailbox-grid',
				'dataProvider'=>$model->search(),
				'rowCssClassExpression' => '($data->destinataires[0]->lu==NULL ? "warning pointer" : "pointer")',
				'selectableRows'=>1,
				'selectionChanged'=>'function(id){ location.href = "'.$this->createUrl('seliste/mail').'&id="+$.fn.yiiGridView.getSelection(id);}',
				'summaryText'=>'Messages {start} à {end} sur {count}',
				'columns'=>array(
					'sujet',
					array (
							'name' => 'idseliste_em',
							'type' => 'html',
							'value'=>'$data->auto ? "-" : $data->idselisteEm->pseudo'
					),	
					array(
							'name'=>'date',
							'value'=>'Yii::app()->dateFormatter->format(\'dd/MM/yyyy HH:mm:ss\',$data->date)'
					),
					array(
						'class'=>'CButtonColumn',
						'header'=>'',
						'template' => '{delete}',
						'deleteButtonImageUrl' => false, 
						'buttons'=>array(
									'delete'=>array(
											'label'=>"",
											'url'=>'Yii::app()->createUrl("seliste/delmail", array("id"=>$data->id))',
											'options'=>array(
												"class"=>"fa fa-times-circle",
												"title"=>"Supprimer"
												),
										),  
									),  
					),
				),
			)); 
			?>
		</div>
	</div>
</div>